<!DOCTYPE html>
<body>
<script src="../../../resources/js-test.js"></script>
<input type="date" onclick="changeType(this)" />
<script>
description('Check if we have no crash in a case that the input type is changed by clicking the calendar picker indicator.');

function changeType(input) {
    input.type = 'text';
    testPassed('unless crash or assertion failure');
    finishJSTest();
}

jsTestIsAsync = true;
if (!window.eventSender) {
    debug('Click on the triangle in the input field.');
} else {
    setTimeout(function() {
        var dateInput = document.getElementsByTagName('input')[0];
        eventSender.mouseMoveTo(dateInput.offsetLeft + dateInput.offsetWidth - 6,
                                dateInput.offsetTop + dateInput.offsetHeight / 2);
        eventSender.mouseDown();
        eventSender.mouseUp();
    }, 0);
}
</script>
</body>
